<?php
include_once "Report_DAO.php";

class Report extends Report_DAO{
	/**
	 * A report can only be displayed by:
	 * <ul>
	 * <li>The user who created it</li>
	 * <li>The manager (direct or indirect) of the user who has created the report</li>
	 * </ul>
	 */
	public function isAccessAllowed($p_userId){
		return $this->getUser_Id()==$p_userId
			|| $this->getUser_id_Ref()->isUserManager($p_userId);
	}
	
	/**
	 * Return "yes" if the report has been validated "no" otherwise.
	 * @return string
	 */
	public function getValidatedLabel(){
		if($this->getValidated()){
			return "yes";
		}
		return "no";
	}
}
?>